package com.transpeed.payservice.pay.unionpospay;

import com.transpeed.payservice.log.InitLogger;
import com.transpeed.payservice.log.Log;
import com.transpeed.payservice.pay.unionpospay.PosTrade.posinf;

public class PosSign {
	public static void main(String[] args) {
		InitLogger.Createfolder();
		Log.Write("*****开始执行签到程序*****", "LocalPos");
		Sign();
	}

	// Pos机签到使用
	public static void Sign() {
		String PosTradeStatus = null;
		String PosID = "12345678";// POS机号,8位,不足右补空格
		String PosStaffID = "87654321";// POS员工号,8位,不足右补空格
		String Sign = "05";// 交易类型标志，2位 05为签到
		String Amount = "000000000001";
		String LRCNmuber = "123";// LRC校验,3位随机数字
		String request = PosID + PosStaffID + Sign + Amount + LRCNmuber;
		byte[] response = new byte[148];
		posinf.Instance.bankall(request, response);
		String info = new String(response);
		String PosStatusCode = info.substring(0, 2);
		if (PosStatusCode.equals("00"))// 成功
			PosTradeStatus = "签到成功！";
		else
			PosTradeStatus = "签到失败！错误码为：" + PosStatusCode;
		Log.Write(PosTradeStatus, "LocalPos");
	}
}
